Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AddAnyAttr experimentation on AnyView #3461

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

geoffreygarrett
Copy link
Contributor

Another attempt: Add from_box constructor to avoid recursive type expansion when adding attributes to type-erased views.

@geoffreygarrett geoffreygarrett changed the base branch from any-view-any-attr to main January 9, 2025 16:35
@geoffreygarrett geoffreygarrett changed the title fix: prevent infinite compilation in AnyView::add_any_attr AddAnyAttr experimentation on AnyView Jan 9, 2025
@zakstucke
Copy link
Contributor

Same issue :(

10 minutes or so of compiling ends in:
cannot encode offset of relocations; object file too large

- Pre-erased `AddAnyAttr` output to `AnyView` to prevent excessive monomorphizations.
- Introduced `DynValueAttr` to minimize deep generic recursion using dynamic dispatch.
- Marked heavy generic functions with `#[inline(never)]` to reduce code bloat.
- Ensured single dynamic call for attribute application to simplify logic and improve efficiency.

This change attempts to address compile-time blow-ups and linker crashes for large projects using `AnyView` with dynamic attributes.
@zakstucke
Copy link
Contributor

Still no change unfortunately but was a good effort! I think until we get some feedback from the rust team on rust-lang/rust#130729 I'm out of ideas.

That's for the compiler errors arising on leptos stable, but I'm sure this issue will have a similar root cause.

@benwis
Copy link
Contributor

benwis commented Jan 19, 2025

Still no change unfortunately but was a good effort! I think until we get some feedback from the rust team on rust-lang/rust#130729 I'm out of ideas.

That's for the compiler errors arising on leptos stable, but I'm sure this issue will have a similar root cause.

@zakstucke Can you create a new rust lang issue about this specific AddAnyAttr implementation, include a reproduction, and then I'll see if I can poke some people I know on the Rust team.

I worry the old one got too general and unfocused

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants